/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.io.*;

/**
 * <p>Project: javase - File3
 * <p>Powered by webrx On 2021-12-14 09:23:56
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class File3 {
    public static void main(String[] args) throws FileNotFoundException {
        //写文件输出流output

        //每次都覆盖文件，是删除建立新文件并写入
        //PrintWriter out = new PrintWriter("user.txt");
        //out.printf("中文时间:%tF %<tT%n", System.currentTimeMillis());
        //out.flush();
        //out.close();

        //读文件input try with
        String file = "user.txt";
        file = "C:\\javase\\09io\\src\\cn\\webrx\\File3.java";
        try (FileInputStream fis = new FileInputStream(file)) {
            byte[] buf = fis.readAllBytes();
            System.out.println(new String(buf));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
